package org.example.platform.design.beiwanglu;


/**
 * 备忘录模式
 */
public class Test {
    public static void main(String[] args) {
        PlayRole gameRole = new PlayRole();
        // 初始化状态
        gameRole.getShow();
        // 展示
        gameRole.show();


        System.out.println("---------------------进入下一状态----------------------");

        // 保存进度
        RoleStateMnager roleStateMnager = new RoleStateMnager();
        roleStateMnager.roleState = gameRole.savePlayRole();

        // boss大战，损耗
        gameRole.fight();
        gameRole.show();

        // 恢复之前打的状态
        gameRole.playRole(roleStateMnager.roleState);
        gameRole.show();

    }
}
